package com.xonro.common.histrans.sfeg.job.update;

import com.actionsoft.bpms.commons.database.RowMap;
import com.actionsoft.bpms.schedule.IJob;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.sdk.local.SDK;
import com.xonro.common.histrans.base.consts.SfegConst;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import java.util.List;

public class    updateContractPayCusInfo implements IJob {
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        List<RowMap> contractMap = DBSql.getMaps("SELECT ID,APPLY_NO  FROM BO_XR_CFM_CONTRACT_PAY ");

        for (RowMap map : contractMap) {
            String applyNo = map.getString("APPLY_NO");
            String id = map.getString("ID");
            SDK.getLogAPI().consoleInfo("打印申请号=======" + applyNo);
            RowMap accountMap = SDK.getCCAPI().getRDSAPI(SfegConst.CCID).getMap("SELECT * FROM tb_ContractMoneyOut out LEFT JOIN tb_khxx cus on cus.khbh=out.khbh WHERE  out.cmoCode='" + applyNo + "' ");
            String khbh = accountMap.getString("khbh");
            String khmc = accountMap.getString("khmc");
            String BankName = accountMap.getString("BankName");
            String BankAccount = accountMap.getString("BankAccount");
            SDK.getLogAPI().consoleInfo("获取修改的申请单号====" + applyNo);
            DBSql.update("UPDATE BO_XR_CFM_CONTRACT_PAY SET COLLECT_COMPANY_NO='" + khbh + "',COLLECT_COMPANY_NAME='" + khmc + "',ACCOUNT_NAME='" + khmc + "',BANK_NAME='" + BankName + "',BANK_ACCOUNT='" + BankAccount + "'  WHERE ID='" + id + "' ");
        }

    }
}
